<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('疫情防控信息收集信息')" />
</head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <div class="form-group">
                                <label class="col-sm-3 control-label"><i class="text-danger">*</i> 审核状态：</label>
                                <div class="col-sm-8">
                                    <div class="radio-box" th:each="dict : ${@dict.getType('aduit_status')}">
                                        <input type="radio" th:id="${'aduitStatus_' + dict.dictCode}" name="aduitStatus" th:value="${dict.dictValue}" required="required">
                                        <label th:for="${'aduitStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                                    </div>
                                </div>
                            </div>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" id="serarchButton" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = 1;
        var collectTypeDatas = [[${@dict.getType('collect_type')}]];
        var userTypeDatas = [[${@dict.getType('user_type')}]];
        var akmStatusDatas = [[${@dict.getType('akm_status')}]];
        var hsResultDatas = [[${@dict.getType('hs_result')}]];
        var xcmIsLeaveDatas = [[${@dict.getType('sys_yes_no')}]];
        var twIsNormalDatas = [[${@dict.getType('sys_yes_no')}]];
        var aduitStatusDatas = [[${@dict.getType('aduit_status')}]];
        var prefix = ctx + "wxcp/epidemic/collect";

        $(function() {
            var options = {
                url: prefix + "/aduitList",
                // pagination: false,
                // showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                modalName: "疫情防控信息审核",
                columns: [
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'deptName',
                    title: '部门名称'
                },
                {
                    field: 'userName',
                    title: '用户名称'
                },
                {
                    field: 'akmStatus',
                    title: '安康码状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(akmStatusDatas, value);
                    }
                },
                {
                    field: 'hsTime',
                    title: '核酸检测时间'
                },
                {
                    field: 'hsResult',
                    title: '两日内核酸检测结果',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(hsResultDatas, value);
                    }
                },
                /*{
                    field: 'hsPath',
                    title: '核酸检测文件路径'
                },*/
                {
                    field: 'xcmIsLeave',
                    title: '行程码14天是否未离肥',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(xcmIsLeaveDatas, value);
                    }
                },
                {
                    field: 'twIsNormal',
                    title: '体温是否正常',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(twIsNormalDatas, value);
                    }
                },
                {
                    field: 'aduitStatus',
                    title: '审核状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(aduitStatusDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.aduitStatus == 0){
                            actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="infoAduit(\'' + row.id + '\')"><i class="fa fa-edit"></i>审核</a> ');
                        }
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        //审核已选内容
        function aduitInfo(){
            table.set();
            var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.confirm("确认已审核选中的" + rows.length + "条收集信息吗?", function() {
                var url = "/epidemic/collect/aduitInfos";
                var data = { "ids": rows.join() };
                $.operate.submit(url, "post", "json", data);
            });
        }



        //全部审核
        function aduitInfoAll(){
            table.set();
            $.modal.confirm("确认已审核所有列表信息吗?", function() {
                var url = "/epidemic/collect/aduitInfosAll";

                var data = {
                            belongDate: $("#belongDate").val(),
                            deptId: $("#deptId").val()
                            };
                $.operate.submit(url, "post", "json", data);
            });
        }

        //信息审核
        function infoAduit(id){
            table.set();
            window.location.href = '/wxcp/epidemic/collect/aduitEdit/' + id;
        }

        // 页面刷新
        if(window.name != "bencalie"){
            location.reload();
            window.name = "bencalie";
        }
        else{
            window.name = "";
        }
    </script>
</body>
</html>
